package com.xqboss.apps.domain.marketing;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xqboss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 * 专题页
 * </p>
 *
 * @author fu.yang
 * @since 2021-12-30
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value = "ThemePage对象", description = "专题页")
public class ThemePage extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "预览标题")
    private String title;

    @ApiModelProperty(value = "预览图")
    private String cover;

    @ApiModelProperty(value = "外显标签id数组json")
    private String showTags;

    @ApiModelProperty(value = "标签id数组json")
    private String tags;

    @ApiModelProperty(value = "page类型 1:文章 2:专题页")
    private Integer pageType;

    @ApiModelProperty(value = "概述")
    private String introduce;

    @ApiModelProperty(value = "是否推荐 0:不推荐 1:推荐")
    private Integer recommend;

    @ApiModelProperty(value = "是否开启 0:不开启 1:开启")
    private Boolean status;

    @ApiModelProperty(value = "排序标志")
    private Integer sortSign;

    @ApiModelProperty(value = "文章ID集合")
    @TableField(exist = false)
    private List<Integer> articleIds;

    @ApiModelProperty(value = "关联的藏品id集合")
    private String ids;

    @ApiModelProperty
    private Boolean isShow;

    public enum TypeEnum {
        文章(1),
        专题页(2);

        public Integer value;

        TypeEnum(Integer value) {
            this.value = value;
        }

        private TypeEnum type() {
            return this;
        }

        public static TypeEnum getType(Integer value) {
            TypeEnum[] enums = values();
            for (TypeEnum enumItem : enums) {
                if (enumItem.value == value) {
                    return enumItem.type();
                }
            }
            return null;
        }
    }

}
